package com.zys.exercise;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;

public class text1 {
    public static void main(String[] args) {
        Map<Integer,String> m =new HashMap<>();
        m.put(1,"aaa");
        m.put(2,"bbb");
        System.out.println(m);
        System.out.println(m.put(3, "ccc"));
        System.out.println(m.put(1, "ccc"));
        System.out.println(m.remove(2));
        System.out.println(m);
        System.out.println("-------------------------------------------------------------");
        Set<Integer> keys = m.keySet();
        for (Integer key : keys) {
            System.out.println(m.get(key));
        }
        Iterator<Integer> it = keys.iterator();
        while (it.hasNext()){
            System.out.println(m.get(it.next()));
        }


    }
}
